package com.applications.codemash.core;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public abstract class GrouperBase
{
	public abstract Map<String, List<Session>> Group(List<Session> sessionCollection);
	
	protected Map<String, List<Session>> Sort(Map<String, List<Session>> listing)
	{
		List<String> keyList = new ArrayList<String>();
		Map<String, List<Session>> returnMap = new HashMap<String, List<Session>>();
		
		for (String key : listing.keySet()) keyList.add(key);
		
		Collections.sort(keyList);
		for (String key : keyList)
		{
			List<Session> sessionList = listing.get(key);
			Collections.sort(sessionList);
			returnMap.put(key, sessionList);
		}
		
		return returnMap;
	}
}
